// uvm_tb/env/binary_alu_env.sv
`ifndef BINARY_ALU_ENV_SV
`define BINARY_ALU_ENV_SV

class binary_alu_env extends uvm_env;

    // ========================================================================
    // Data Members
    // ========================================================================
    binary_alu_agent      m_agent;
    binary_alu_scoreboard m_scoreboard;

    // ========================================================================
    // UVM Macros
    // ========================================================================
    `uvm_component_utils(binary_alu_env)

    // ========================================================================
    // Constructor
    // ========================================================================
    function new(string name, uvm_component parent);
        super.new(name, parent);
    endfunction

    // ========================================================================
    // UVM Build Phase
    // ========================================================================
    virtual function void build_phase(uvm_phase phase);
        super.build_phase(phase);
        m_agent      = binary_alu_agent::type_id::create("m_agent", this);
        m_scoreboard = binary_alu_scoreboard::type_id::create("m_scoreboard", this);
    endfunction

    // ========================================================================
    // UVM Connect Phase
    // ========================================================================
    virtual function void connect_phase(uvm_phase phase);
        // Connect monitor to scoreboard
        m_agent.m_monitor.item_collected_port.connect(m_scoreboard.trans_analysis_imp);

        // We need a way to get expected transactions to the scoreboard.
        // This can be done via a predictor or another analysis port from the sequencer.
        // For simplicity, we'll add a direct handle for now.
    endfunction

endclass : binary_alu_env

`endif  // BINARY_ALU_ENV_SV
